Skip to content

Conversation

zonuexe
Copy link
Contributor

@zonuexe zonuexe commented Mar 11, 2025

@zonuexe zonuexe marked this pull request as draft March 11, 2025 11:52
@zonuexe zonuexe changed the title Impl keyless array-shapes as Tuple Treat array-shapes without keys as tuples Mar 11, 2025
@zonuexe
Copy link
Contributor Author

zonuexe commented Mar 11, 2025

I'm a bit surprised that this single change digs up list-shapes that were previously imported from Psalm.

2) PHPStan\Analyser\NodeScopeResolverTest::testFile with data set "tests/PHPStan/Analyser/nsrt/list-shapes.php" ('/home/runner/work/phpstan-src...es.php')
Failed assertions in /home/runner/work/phpstan-src/phpstan-src/tests/PHPStan/Analyser/nsrt/list-shapes.php:

Line 21:
Expected: array{'a'}
Actual:   list{'a'}

Line 22:
Expected: array{'a', 'b'}
Actual:   list{'a', 'b'}

Line 23:
Expected: array{0: 'a', 1?: 'b'}
Actual:   list{0: 'a', 1?: 'b'}

@zonuexe zonuexe force-pushed the feature/keyless-constant-as-tuple branch from dbc452f to c044612 Compare March 11, 2025 12:42
@ondrejmirtes
Copy link
Member

We tried something similar here but decided against it #3381

@ondrejmirtes
Copy link
Member

I don't think we should make any difference between array{int} and array{0: int}`. It should be the same thing...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants